<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!--edge浏览器H5兼容设置-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--360浏览器H5兼容设置-->
    <meta name="renderer" content="webkit" />
    <title>找回密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!--    联网方式-->
    <!--  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
      <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
  -->
    <!--导入核心文件-->
    <script src="../bootstrap3/js/holder.js"></script>
    <link href="../bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css">
    <script src="../bootstrap3/jquery-1.9.1.min.js"></script>
    <script src="../bootstrap3/js/bootstrap.js"></script>
    <!-- 字体图标 -->
    <link rel="stylesheet" href="../bootstrap3/font-awesome-4.7.0/css/font-awesome.css" />

    <script src="../bootstrap3/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>

    <link rel="stylesheet" type="text/css" href="../css/findPwd.css"/>
</head>

<body>
<!--网页最上方的留白-->
<header>
    <!-- class.container 容器定位 的作用是进行居中布局 -->
    <div class="container">
        <!-- pull-right 向右对齐  -->
        <span class="pull-right"><small>Sports  Equipment</small> <b>Management</b>System</span>

    </div>
</header>

<!--网页 导航栏 在layout.css 文件中设置背景图片-->
<nav>
    <!-- class.container 容器定位 用于设置内容居中 -->
    <div class="container">
        <h1>
            <b>体育器材管理系统</b> <small>——Design by Z</small>
        </h1>

        <!--导航栏-->
        <div>
            <!-- class="nav navbar-nav" 定义导航条 -->
            <ul class="nav navbar-nav">
                <li><a href="login.html">登录</a></li>
                <li><a href="register.html">注册</a></li>
            </ul>
            <!-- class="nav navbar-nav" 定义导航条 向右侧浮动 -->
            <ul class="nav navbar-nav navbar-right">
                <!-- 导航条中的文字使用 class="navbar-text" 样式 -->
                <li><span class="navbar-text"></span></li>

            </ul>
        </div>
        <!-- /导航栏 -->
    </div>
</nav>

<!--主体-->
<section>
<div class="container">
    <div class="row">
        <div class="col-md-4 col-sm-4"></div>
        <div class="col-md-4 col-sm-4">
            <br>

            <!--表单开始-->
            <form id="form-findPwd"  class="form-horizontal" role="form">
                <p>找回密码</p>
                <hr>
                <br>
                <!--用户名-->
                <div class="form-group" >
                    <label for="num" class="col-md-3 col-sm-3 control-label">工&#12288;号：</label>
                    <div class="col-md-8 col-sm-8">
                        <input name="num" type="text" class="form-control" id="num"  placeholder="请输入您的工号">
                    </div>

                </div>
                <br>
                <!--密码-->
                <div class="form-group">
                    <label for="key"   style="display: block" class="col-md-3  col-sm-3 control-label"> 验证码：</label>
                    <div class="col-md-8 col-sm-8">
                    <input type="text" class="form-control1" id="key" name="key">
                    <input type="button" class="btn btn-primary" id="sendVerificationCode" value="获取验证码"/>
                    </div>
                </div>
                <div class="form-group" >
                    <div class="col-md-4 col-sm-4 "></div>
                    <div class="col-md-4 col-sm-4">
                        <input  type="button" class="btn btn-primary" id="backPwd"  value="找回密码">
                    </div>
                    <div class="col-md-4 col-sm-4 "></div>
                </div>
            </form>
        </div>
        <div class="col-md-4 col-sm-4"></div>
    </div>
</div>

</section>

<!--页脚开始-->
<!--网页底部， class.well 用于设置背景效果-->
<footer class="well">
    <!-- class.container 的作用是进行居中布局 -->
    <div class="container">
        <b>Copyright © 2020 ？？.com All Rights Reserved
            <a href="#">啥也不是</a>
            版权所有
        </b> <span class="pull-right"> <b>Version</b> 1.1.0
      </span>
    </div>
</footer>
<!--页脚结束-->

<script type="text/javascript">
    $("#sendVerificationCode").click(function () {
        $.ajax({
            "url":"/users/sendFindPwd",
            "data":{
              num:$("#num").val(),
                key:$("#key").val()
            },
            "type":"post",
            "dataType":"json",
            "success":function (json) {
                if (json.state == 2000) {
                    alert("已发送到您的邮箱，请及时查看")
                }else{
                    alert(json.data)
                }
            }
        })
    })
    $("#backPwd").click(function () {
        $.ajax({
            "url":"/users/backPwd",
            "data":$("#form-findPwd").serialize(),
            "type":"post",
            "dataType":"json",
            "success":function (json) {
                if (json.state == 2000) {
                    alert("验证成功，请重置您的密码")
                    window.location.href="ResetPwd.html"
                }else{
                    alert(json.data)
                    $("#key").val("")
                }
            }
        })
    })

</script>
</body>
</html>